using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Diagnostics;

namespace sb0t_winGUI
{
    class RunOnceFileUpdater
    {
        public static String sbotpath;

        public static void DoJobs()
        {
            String path = AppDomain.CurrentDomain.BaseDirectory;

            if (Directory.Exists(path + "data"))
            {
                sbotpath = path;
            }
            else
            {
                try
                {
                    path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
                    path += "\\" + Process.GetCurrentProcess().ProcessName;

                    if (!Directory.Exists(path))
                        Directory.CreateDirectory(path);

                    sbotpath = path + "\\";
                }
                catch
                {
                    sbotpath = AppDomain.CurrentDomain.BaseDirectory;
                }
            }

            sbotpath = sbotpath.Replace("\\", "/");

            try
            {
                if (!Directory.Exists(sbotpath + "data"))
                    Directory.CreateDirectory(sbotpath + "data");

                if (!Directory.Exists(sbotpath + "chatlogs"))
                    Directory.CreateDirectory(sbotpath + "chatlogs");
            }
            catch { }
        }
        
    }
}
